package com.example.myapplication.dao;


import com.example.myapplication.model.Game;
import com.example.myapplication.model.User;

import cn.bmob.v3.exception.BmobException;
import cn.bmob.v3.listener.SaveListener;

/**
 * 用户表相关的实现
 */

public class UserDao {

    /**
     * 用户注册
     * @param user
     * @param callback
     */
    public void register(User user, final DataCallback<String> callback) {
        user.save(new SaveListener<String>() {
            @Override
            public void done(String objectId, BmobException e) {
                if (e == null) {
                    callback.onSuccess(objectId);
                } else {
                    callback.onFailure("创建失败: " + e.getMessage());
                }
                callback.onComplete();
            }
        });
    }

}